﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;

namespace TTT
{
    public partial class Form1 : Form
    {
        //   string sql = ;
        // string chuoiketnoi = "Data Source=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 5.107.60.197)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = XE)));User Id=ERP;Password=ERP";
        string oradb = "Data Source=(DESCRIPTION=" + "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=5.107.60.197)(PORT=1521)))" + "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE)));" + "User Id=ERP;Password=ERP;";

        OracleConnection con;
        OracleCommand com = new OracleCommand();
        OracleDataAdapter dr = new OracleDataAdapter();
        DataSet data = new DataSet();
        DataTable dt = new DataTable();
        // OracleTransaction txt;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            con = new OracleConnection(oradb);
            con.Open();

            com.CommandText = "select *from dong";
            // com.CommandText = "insert into dong values ('dai ca dong')";
            //txt.Commit();
            com.Connection = con;
            dr.SelectCommand = com;
            dr.Fill(dt);
            this.dataGridView1.DataSource = dt;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form3 f = new Form3();
            f.Show();
        }
    }
}
